﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace RazorSourceGenerator.Converter
{
    public class TemplatesVisibleConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var param = (string)parameter;
            if (value != null && value is List<TemplateConfig>)
            {
                var templates = (List<TemplateConfig>)value;
                if (templates.Count > 0)
                {
                    if (param == "1")
                        return Visibility.Hidden;
                    else
                        return Visibility.Visible;
                }
            }
            if (param == "1")
                return Visibility.Visible;
            else
                return Visibility.Hidden;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
